/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package uploadfile;

import java.io.File;
import javax.swing.filechooser.FileFilter;

/**
 *
 * @author ToanNhan
 */
public class ImageFileFilter extends FileFilter {

    @Override
    public boolean accept(File f) {
        if (f.isDirectory()){
            return true;
        }
        String fileName = f.getName().toLowerCase();
        String[] imageType = {".bmp", ".jpg", ".gif", ".png"};
        for (String type : imageType){
            if (fileName.endsWith(type)){
                return true;
            }
        }
        return false;
    }

    @Override
    public String getDescription() {
        return "All image files (.bmp;.jpg;.gif;.png)";
    }

}
